#include "AM.h"
#include "../PreambleCtp.h"

configuration PreambleCtpC {

}
implementation {
  components PreambleCtpP, MainC, LedsC, ActiveMessageC;
  components CollectionC as Collector;
  components CtpP;
  components new CollectionSenderC(AM_DATA_MSG) as Send;
  components new TimerMilliC() as TxTimer;
  components new TimerMilliC() as SnifferTimer;
  components CC2420ActiveMessageC;
  components CC2420RadioC;
  components CC2420CsmaC;
  components TimeSyncMessageC;
  components HilTimerMilliC;
  components RandomC;

  components SerialActiveMessageC;
  components new SerialAMSenderC(AM_DATA_MSG);
  components new QueueC(message_t*, 12);
  components new PoolC(message_t, 12);

  PreambleCtpP.Boot -> MainC;
  PreambleCtpP.RadioControl -> ActiveMessageC;
  PreambleCtpP.EnergyControl -> CC2420CsmaC;
  PreambleCtpP.RoutingControl -> Collector;
  PreambleCtpP.RootControl -> Collector;
  PreambleCtpP.CtpInfo -> Collector;
  PreambleCtpP.Send -> Send;
  PreambleCtpP.Intercept -> Collector.Intercept[AM_DATA_MSG];
  PreambleCtpP.Receive -> Collector.Receive[AM_DATA_MSG];

  PreambleCtpP.TxTimer -> TxTimer;
  PreambleCtpP.SnifferTimer -> SnifferTimer;
  PreambleCtpP.RadioPacket -> ActiveMessageC;
  PreambleCtpP.Random -> RandomC;
  PreambleCtpP.Leds -> LedsC;

  PreambleCtpP.SerialControl -> SerialActiveMessageC;
  PreambleCtpP.UARTSend -> SerialAMSenderC.AMSend;
  PreambleCtpP.Queue -> QueueC;
  PreambleCtpP.Pool -> PoolC;

  PreambleCtpP.SnifferSend -> TimeSyncMessageC.TimeSyncAMSendMilli[AM_SNIFFER_MSG];
  PreambleCtpP.LocalTime -> HilTimerMilliC;
  PreambleCtpP.LplInfo -> CC2420RadioC.LplInterface;
  PreambleCtpP.LinkEstimator -> CtpP;
  PreambleCtpP.ProbeInfo -> CC2420RadioC.ProbeInterface;
  PreambleCtpP.CC2420Packet -> CC2420ActiveMessageC;
  PreambleCtpP.LowPowerListening -> ActiveMessageC;
}
